<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <title>{$sysinfo['title']}</title>
    <link rel="stylesheet" href="/static/css/weui.css" />
    <link rel="stylesheet" href="/static/css/kouhong.css"/>
    <link rel="stylesheet" href="/static/css/member.css"/>

</head>
<style>
    .mask {
        display: none;
        width: 100%;
        height: 100%;
        position: fixed;
        top: 0;
        left: 0;
        background-color: rgba(0,0,0,.5);
        z-index: 999999;
    }
    .mask > img.share_img {
        width: 80%;
        position: relative;
        top: 10px;
        left: 10%;
    }
</style>
<body>
<!--we7/pages/user/user.wxml-->
<div class="page " id="page">
    <div class="bg_img" style="background:url('/static/img/bg22.png') no-repeat; background-size:100% auto;-moz-background-size:100% auto">
        <div class="header">
            <div class="kh_user">
                <img id="header_url" src="/static/img/kh.png"/>
            </div>
            <div class="kh_title">{$user['nickname']}</div>
            <div class="kh_title">uid:{$user['id']}</div>
        </div>
        <div class="kh_box">
            <div class="kh_box_item">
                <div class="kh_grid line" id="my_kh">
                    <div class="kh_my">我的口红</div>
                    <div class="kh_grid_box">
                        <div class="kh_grid_img">
                            <img src="/static/img/kh_img.png"/>
                        </div>
                        <div class="kh_grid_num" id="kh_num">0</div>
                    </div>

                </div>

                <div class="kh_grid">
                    <div class="kh_my">我的余额</div>
                    <div class="kh_grid_box">
                        <div class="kh_grid_pic"><text id="kh_pic">{$user['rouge']}</text><text>元</text></div>


                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 菜单 -->
    <div class="weui-cells">
        <a class="weui-cell weui-cell_access" href="{:url('orders/orderlist',array('platid'=>$user['uniacid']))}">
            <div class="weui-cell__bd">
                我的订单
            </div>
            <div class="weui-cell__ft"></div>
        </a>
        {if condition="($user['level'] == 1)"}
        <a class="weui-cell weui-cell_access"   href="{:url('marke/index',array('platid'=>$user['uniacid']))}">
            <div class="weui-cell__bd">
                我的分销
            </div>
            <div class="weui-cell__ft"></div>
        </a>
{/if}

        <a class="weui-cell weui-cell_access" href="{:url('services/index',array('platid'=>$user['uniacid']))}">
            <div class="weui-cell__bd">
                联系客服
            </div>
            <div class="weui-cell__ft"></div>
        </a>
        <a class="weui-cell weui-cell_access" href="javascript:;" id="share">
            <div class="weui-cell__bd">
                我要分享
            </div>
            <div class="weui-cell__ft"></div>
        </a>
    </div>
    {include file='public/nav'/}
</div>
<div class="mask">
    <img src="/static/img/share_cards.png" alt="" class="share_img">
</div>
<div id="dialogs">
    <div class="js_dialog" id="showModal4" style="display: none;">
        <div class="weui-mask"></div>
        <div class="weui-dialog modal-dialog">
            <div class="weui-dialog_hd kh_none">抓中的口红</div>
            <div class="weui-dialog_bd">
                <div class="modal-body">

                    <div class="modal-kh_box" >
                        <div class="kh_grids" id="rougelist">
                        </div>
                    </div>
                </div>
            </div>

            <div class="weui-dialog_ft">

            </div>

        </div>
    </div>
</div>



</body>
<script src="/static/js/jquery-3.2.1.js"></script>
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script>
    wx.config({$jssdkconfig});
    wx.ready(function () {
        wx.onMenuShareAppMessage({
            title: "{$jssdksharedata['title']}", // 分享标题
            desc: "{$jssdksharedata['desc']}", // 分享描述
            link: "{$jssdksharedata['link']}", // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
            success: function () {
                $.ajax({
                    url: "{:url('member/sharebalace')}",
                    data: {
                    },
                    dataType: "json",
                    type: "post",
                    success: function (res) {
                        console.log(11,res);
                        if(res.code==0){

                        }
                    }
                })
            }
        });
        wx.onMenuShareTimeline({
            title: '', // 分享标题
            link: '', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
            imgUrl: '', // 分享图标
            success: function () {
                // 用户点击了分享后执行的回调函数
                $.ajax({
                    url: "{:url('member/sharebalace')}",
                    data: {
                    },
                    dataType: "json",
                    type: "post",
                    success: function (res) {
                        console.log(11,res);
                        if(res.code==0){

                        }
                    }
                })
            },
        })

    })
        </script>
<script>

    $("#share").click(function(){
        $(".mask").css("display","block");
    });
    $(".mask").click(function(){
        $(".mask").css("display","none");
    })
</script>
<script>
    $(function() {
        $.ajax({
            url: "{:url('')}",
            data: {},
            dataType: "json",
            type: "post",
            success: function (res) {
                console.log(66, res);
                if (res.code == 0) {
                  $("#kh_pic").text(res.data.balance);
                  $("#kh_num").text(res.data.rouge);
                  $("#header_url").attr("src",res.data.header_url);

                }
            }
        });
    })
</script>
<script type="text/javascript">
    $(function(){
        var $showModal4 = $('#showModal4')

        $('#dialogs').on('click', '.js_dialog', function(){
            $(this).fadeOut(200);
            $("#page").removeClass("pages");
        });

        $('#my_kh').on('click', function(){
            $.ajax({
                url: "{:url('member/myrouge')}",
                data: {},
                dataType: "json",
                type: "post",
                success: function (res) {
                    console.log(88, res);
                    if (res.code == 0) {
                        var data=res.data;
                        var list=""
                        for(var i=0;i<data.length;i++){

                            list += '                            <div class="kh_grids-item rouge" data-id="'+data[i].id+'">\n' +
                                '                                <div class="kh_imgi"><img src="'+data[i].img_url+'" /></div>\n' +
                                '                                <div class="kh_grids_pic">\n' +
                                '                                    <div>'+data[i].title+'</div>\n' +
                                '                                    <div>原价￥'+data[i].ori_price+'</div>\n' +
                                '\n' +
                                '                                </div>\n' +
                                '\n' +
                                '                            </div>\n';

                        }
                        $("#rougelist").html(list);
                        $("#page").addClass("pages");
                        $showModal4.fadeIn(200);

                    }else{
                        setTimeout(function(){
                            window.location.href ="{:url('notime/index',array('platid'=>$user['uniacid']))}";
                        },500)
                    }
                }
            });

        });
        $('#rougelist').on('click', '.rouge', function() {
            event.stopPropagation();

            var id=$(this).attr("data-id");
            setTimeout(function(){
                window.location.replace("{:url('orders/suborder',array('platid'=>$user['uniacid']))}&prize_id="+id)
            },500)
        })

    });
</script>
</html>
